<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('在制品按模块片数统计列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>工段名称：</label>
                                <input type="text" name="stageName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="report:wipstageqtysta:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">

        var prefix = ctx + "report/wipstageqtysta";

        var columns =
            [
            [
                {
                    title : '',
                    align : 'center',
                    colspan : 5
                },
                {
                    title : 'Run',
                    align : 'center',
                    colspan : 3
                },
                {
                    title : 'Wait',
                    align : 'center',
                    colspan : 3
                },
                {
                    title : 'Hold',
                    align : 'center',
                    colspan : 1
                }
            ],
            [
                {
                    field: 'NO1',
                    align : 'center',
                    title: 'NO',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'lightCarveLayerSeq',
                    align : 'center',
                    title: '光刻层序号'
                },
                {
                    field: 'stageName',
                    align : 'center',
                    title: '工段名称'
                },
                {
                    field: 'stageDsc',
                    align : 'center',
                    title: '工段描述'
                },
                {
                    field: 'mainQty',
                    align : 'center',
                    title: '总片数'
                },
                {
                    field: 'runStatusQty',
                    align : 'center',
                    title: 'run状态片数'
                },
                {
                    field: 'runStandardTime',
                    align : 'center',
                    title: 'run状态标准时长(小时)'
                },
                {
                    field: 'runOverStandardQty',
                    align : 'center',
                    title: 'run状态超标准片数',
                    formatter: function(value, row, index) {
                        if (null == value) {
                            return;
                        }
                        return '<a class="" onclick="overStandardClick(\'' + row.stageName + '\',\'' + 'RUN' + '\')">' + row.runOverStandardQty + '</a>';
                    }
                },
                {
                    field: 'waitStatusQty',
                    align : 'center',
                    title: 'wait状态片数'
                },
                {
                    field: 'waitStandardTime',
                    align : 'center',
                    title: 'wait状态标准时长(小时)'
                },
                {
                    field: 'waitOverStandardQty',
                    align : 'center',
                    title: 'wait状态超标准片数',
                    formatter: function(value, row, index) {
                        if (null == value) {
                            return;
                        }
                        return '<a class="" onclick="overStandardClick(\'' + row.stageName + '\',\'' + 'WAIT' + '\')">' + row.waitOverStandardQty + '</a>';
                    }
                },
                {
                    field: 'holdStatusQty',
                    align : 'center',
                    title: 'hold状态片数',
                    formatter: function(value, row, index) {
                        if (null == value) {
                            return;
                        }
                        return '<a class="" onclick="holdinfoClick(\'' + row.stageName + '\',\'' + 'HOLD' + '\')">' + row.holdStatusQty + '</a>';
                    }
                }
            ]
        ];

        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "在制品按模块片数统计",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination: false,
            columns: columns
        };

        $(function() {
            $.table.init(options);
        });

        // 超标准点击事件
        function overStandardClick(stageName, state) {
            if (stageName == null || stageName == "" || stageName == "undefined" || state == null || state == "" || state == "undefined") {
                return null;
            }
            // 打开窗口，展示超标准的每卡的详细信息
            var url = prefix + "/wipstageqtyinfo?stageName=" + stageName + "&state=" + state;
            var options = {
                title: '在制品超标准每卡详情',
                btn: 0,
                url: url,
                full: true,
                width: 800,
                height: $(window).height() - 50
            };
            $.modal.openOptions(options);
        }

        // hold状态点击事件
        function holdinfoClick(stageName, state) {
            if (stageName == null || stageName == "" || stageName == "undefined" || state == null || state == "" || state == "undefined") {
                return null;
            }
            // 打开窗口，展示超标准的每卡的详细信息
            var url = prefix + "/wipstageqtyholdinfo?stageName=" + stageName + "&state=" + state;
            var options = {
                title: '在制品hold状态每卡详情',
                btn: 0,
                url: url,
                full: true,
                width: 800,
                height: $(window).height() - 50
            };
            $.modal.openOptions(options);
        }
    </script>
</body>
</html>